package com.lww.feature.test.thread;

/**
 * User: yian
 * Date: 2017/8/24
 */
public class test {

    static class TestErrorThread implements Runnable{

        @Override
        public void run() {
            try {
                throw new StackOverflowError();

            } catch (Throwable throwable) {
                System.out.println("捕获到error");
            }
        }
    }
    static class TestExceptionThread implements Runnable{

        @Override
        public void run() {
            throw new RuntimeException();
        }
    }

    public static void main(String[] args) {

        Runnable testRunabele = new TestErrorThread();
//        Runnable testRunabele = new TestExceptionThread();

        Thread thread = new Thread(testRunabele);
        thread.start();
        try {
            Thread.sleep(10000);
            System.out.println("jvm进程没有终止");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }


    }

}
